The GetExpand method retrieves a named value of data type REG_EXPAND_SZ, REG_DWORD, or REG_SZ from a specified registry key. When a REG_EXPAND_SZ named value is retrieved, the method expands any embedded environment variables.
GetExpand(FullKeyValueName)
HKLM\Software\MyCompany\MyValue
The key portion of this parameter can be a key on either a local or a remote machine. Keys on a remote machine are specified by prefixing the key name with the machine name. For example:
\\RemoteMachine\HKLM\Software\MyProg
A string that contains the retrieved named value. Any embedded environment variables, such as %SystemRoot%, are replaced with their expanded values.
LogFileDirectory
from the registry key HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\
. The example uses the Get method to retrieve LogFileDirectory
without expanding the environment variables and then uses the GetExpand method to retrieve the named value and include expanded environment variables. <% Set Reg = Server.CreateObject("IISSample.Registry") LFD = Reg.Get("HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\LogFileDirectory") LFDEX = Reg.GetExpand("HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\LogFileDirectory") %> LogFileDirectory = <%= LFD %><br> LogFileDirectory Expanded = <%= LFDEX %>
LogFileDirectory
is %SystemRoot%\System32\LogFiles\, the output would be:LogFileDirectory = %SystemRoot%\System32\LogFiles\ LogFileDirectory Expanded = D:\Winnt\System32\LogFiles\